#!/usr/bin/python
from django.contrib.auth.models import Group, Permission
from django.contrib.contenttypes.models import ContentType

principal_group = Group(name="Diretores")
principal_group.save()

teacher_ct = ContentType.objects.get(app_label='people', model='teacher')
teacher_perms = Permission.objects.filter(content_type=teacher_ct)

student_ct = ContentType.objects.get(app_label='people', model='student')
student_perms = Permission.objects.filter(content_type=student_ct)

employee_ct = ContentType.objects.get(app_label='people', model='employee')
employee_perms = Permission.objects.filter(content_type=employee_ct)

scholarclass_ct = ContentType.objects.get(app_label='grades', model='scholarclass')
scholarclass_perms = Permission.objects.filter(content_type=scholarclass_ct)

for perm in (student_perms): principal_group.permissions.add(perm)

for perm in (teacher_perms): principal_group.permissions.add(perm)

for perm in (employee_perms): principal_group.permissions.add(perm)

for perm in (scholarclass_perms): principal_group.permissions.add(perm)


